import numpy as np

n = 0
sumX2 = np.array([0.]*6)
sumX = np.array([0.]*6)

for congress in congress_range:
    with open("C://Users//Christian//Dropbox//Coalitions//match//agmatch-" + str(congress) + ".json", 'r') as matchf:
        match_data = json.load(matchf)
        for profile in match_data:
            for pair in match_data[profile]:
                n += 1
                #y = [pair[2], int(pair[3]) + int(pair[4]), int(pair[5]) + int(pair[6]), pair[7]]
                y = pair[2:]
                sumX += np.array([float(x) for x in y])
                sumX2 += np.array(np.power([float(x) for x in y], 2))

sdX = np.sqrt(sumX2/n - np.power(sumX/n, 2))